birth_year = input('Birth year: ')
# input函数，无论你在终端输入什么，都会被认为是字符串类型的
# int()
# float()
# bool()
# 以上函数是强制转换类型
# 获得变量的类型，并打印类型的函数 type()函数获取括号内变量的数据类型
print(type(birth_year))
age = 2020 - int(birth_year)
print(type(age))
print(age)
# 下面是错误范例 int(weight)
# weight是str类型的
# 通过 int(weight)函数，请问weight变成什么类型了
weight = '70'
int(weight)
print(type(weight))
# 可以看出<class 'str'>，weight依然是str类型的
# weight = input('What your weight in pounds？ ')
# int(weight)
# weight_kg = weight * 0.45
# print(weight_kg)
# 所以改为如下
weight = input('What your weight in pounds？ ')
weight_kg = int(weight) * 0.45
print(weight_kg)
print(str(weight_kg) + 'kg')
# course = 'Python's Course for Beginners' 这句会报错，因为在''s之前字符串就结束了
# 双引号的作用 这时候就可以运用双引号
course = "Python's Course for Beginners"
print(course)
# 同样单引号也有这种用法
course = 'Python for "Beginners"'
print(course)
course = '''
Hi John

Here is our first email to you.

Thank you,
The support team
'''
print(course)
course = 'Python for Beginners'
print(course[0])  # 这个就是索引，我们在其它编程语言中没有的特性之一 P
print(course[-1])  # s
print(course[-2])  # r
print(course[0:3])  # Pyt
print(course[0:])  # Python for Beginners
print(course[1:])
print(course[:5])
# copy [:]
course = 'Python for Beginners'
another = course[:]
print(another)
name = 'Jennifer'
print(name[1:-1])
